import { isTrue } from "@/utils/tools";
import { OssData } from "@/utils/upload";

export const columns: F.TableColumns[] = [
    {
        title: '文件名',
        key: 'filename',
        dataIndex: 'filename',
        align: 'center',
        width: 300,
    },
    {
        title: '图片',
        key: 'url',
        dataIndex: 'url',
        align: 'center',
        customRender: ({ record }: F.RableSlotScope<OssData>) =>
            isTrue(record.url) ? (
                <a-image width={50} src={record.url} />
            ) : '-',
    },
    {
        title: '类型',
        key: 'type',
        dataIndex: 'type',
        align: 'center',
    },
    {
        title: '大小',
        key: 'byte',
        dataIndex: 'byte',
        align: 'center',
        customRender: ({ record }: F.RableSlotScope<OssData>) => `${record.byte}M`
    },
    {
        title: '操作',
        dataIndex: 'action',
        key: 'action',
        align: 'center',
        slots: {
            customRender: 'actionRender',
        },
        fixed: 'right',
    },
]